package Demo;

import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;
import java.util.Set;

/**
 * @author げっしょく
 * @date 2021/7/28
 */
public class Test4 {
    public static void main(String[] args) {
        String s = "hello world java heihei haha hehe";
        HashMap<Character, Integer> hm = new HashMap<>();
        for (int i = 0; i < s.length(); i++) {
            Character c = s.charAt(i);
            if(hm.containsKey(c)){
                Integer integer = hm.get(c);

                hm.put(c,++integer);
            }
            }

            Set<Map.Entry<Character, Integer>> characters = hm.entrySet();
            for (Map.Entry<Character, Integer> character : characters) {
                System.out.println(character.getKey() + "...." + character.getValue());
            }
        }

}
